<template lang="pug">
	.health-card-info
		.userinfo-box(v-if="")
			field-item(text="姓名" :hint="name")
			field-item(text="身份证" :hint="idNumber" :showBorder="false")
		.userinfo-box
			field-item(text="姓名" hint="李光耀")
			field-item(text="出生证明" hint="3310**********9766")
			field-item(text="身份证号" :showArrow="true" hint="去完善" color="#3D8CFF" :showBorder="false")
		.userinfo-box
			field-item(text="姓名" hint="李光耀")
			field-item(text="出生信息" hint="3310**********9766" :showBorder="false")
		.userinfo-box
			field-item(text="就诊手机号" hint="136****7657")
			field-item(text="就诊卡管理" :showArrow="true" :showBorder="false")
		.btn(@click="jumpToUnbind" v-if="showBtn") 解除绑定
</template>
<script>
import fieldItem from '@/components/field-item'
export default {
	data() {
		return {
			showBtn: true //是否显示解除绑定按钮
		}
	},
	computed: {},
	created() {
		this.name = '周冰倩'
	},
	mounted() {
		this.getUserInfo()
	},
	onPullDownRefresh() {},
	onReachBottom() {},
	methods: {
		getUserInfo() {
			let userInfo = this.wx.getStorageSync('userInfo')
			let memberNum = userInfo.memberNum
			this.api.tzApi
				.getCardList({
					mainHealthId: memberNum
				})
				.then(data => {
					if (data.responseFlag === '1') {
						let list = data.data
						for (let i in list) {
							if (list[i].name === this.name) {
								console.log(list[i])
								list[i].familyRelation === '本人'
									? (this.showBtn = false)
									: (this.showBtn = true)
								break
							}
						}
					}
				})
				.catch(() => {})
		},
		jumpToUnbind() {
			this.showModal({
				title: '解绑',
				content: '解绑之后不能查看之前记录，是否确定解绑',
				confirmText: '解绑',
				success: () => {}
			})
		}
	},
	components: {
		fieldItem
	}
}
</script>

<style lang="stylus">
.health-card-info
	.userinfo-box
		margin-top 20px
	.btn
		center()
		font-size 30px
		height 100px
		background-color white
		margin-top 30px
</style>
